#ifndef POKER_H_
#define POKER_H_

#include <QChar>
#include <QDebug>
#include <QMap>
#include <QMapIterator>
#include "../Common/GameInfo.h"


class Poker
{
 bool pairOnBoard;
 bool twoPairsOnBoard;
 bool threeOfAKindOnBoard;
 bool fullHouseOnBoard;
 bool fourOfAKindOnBoard;

 bool pair;
 bool twoPairs;
 bool threeOfAKind;
 bool fullHouse;
 bool fourOfAKind;

 int kickerWeighting;
 int combinationWeighting1;
 int combinationWeighting2;

 QMap<QChar,int> cardsPosition;

 QMap<QChar,int> boardCardsNumberArrayIndexedByCard;
 // TO RENAME: global ?
 QMap<QChar,int> globalCardsNumberArrayIndexedByCard;

 // Rename cardsArrayIndexedByCardWeight
 QMap<int,QChar> cardsArraySortedByCardWeight;
 QMap<QChar,int> cardsPositionArrayIndexedByCard;

 public:
  Poker();

  void initCardsPositionArray();
  void initPokerCombinations();
  void initPokerArray();

  bool getPairOnBoard();
  bool getTwoPairsOnBoard();
  bool getThreeOfAKindOnBoard();
  bool getFullHouseOnBoard();
  bool getFourOfAKindOnBoard();
  bool getPair();
  bool getTwoPairs();
  bool getThreeOfAKind();
  bool getFullHouse();
  bool getFourOfAKind();

  int getKickerWeighting();
  int getCombinationWeighting1();
  int getCombinationWeighting2();

  void setPairOnBoard(bool _pairOnBoard);
  void setTwoPairsOnBoard(bool _twoPairsOnBoard);
  void setThreeOfAKindOnBoard(bool _threeOfAKindOnBoard);
  void setFullHouseOnBoard(bool _fullHouseOnBoard);
  void setFourOfAKindOnBoard(bool _fourOfAKindOnBoard);
  void setPair(bool _pair);
  void setTwoPairs(bool _twoPairs);
  void setThreeOfAKind(bool _threeOfAKind);
  void setFullHouse(bool _fullHouse);
  void setFourOfAKind(bool _fourOfAKind);

  void setKickerWeighting(int _kickerWeighting);
  void setCombinationWeighting1(int _combinationWeighting1);
  void setCombinationWeighting2(int _combinationWeighting2);

  int Combination(GameInfo & gameInfo, int numPlayer);
  void BuildBoardCardsNumberArrayIndexedByCard(GameInfo & gameInfo);
  void BuildGlobalCardsNumberArrayIndexedByCard(GameInfo & gameInfo, int numPlayer);
  void BuildArraySortedByCardWeight(GameInfo & gameInfo, int numPlayer);
  void BuildCardsPositionArrayIndexedByCard();
  void CombinationOnBoard();
  void DisplayCombinationOnBoard();
  void FindPlayerCombination(GameInfo & gameInfo, int numPlayer);
  void DisplayPlayerCombination();
  int getWinner(GameInfo & gameInfo);

};

#endif
